package com.charm.bulkcomponent.vassonic

import android.os.Bundle
import com.tencent.smtt.sdk.WebView
import com.tencent.sonic.sdk.SonicSessionClient
import java.util.HashMap

/**
 * Created by tools on 2018/1/25.
 */
class SonicSessionClientImpl : SonicSessionClient() {
    override fun loadDataWithBaseUrlAndHeader(baseUrl: String?, data: String?, mimeType: String?, encoding: String?, historyUrl: String?, headers: HashMap<String, String>?) {
        loadDataWithBaseUrl(baseUrl, data, mimeType, encoding, historyUrl)
    }

    private var webView: WebView? = null
    fun bindWebView(webView: WebView) {
        this.webView = webView
    }

    override fun loadUrl(url: String, extraData: Bundle) {
        webView!!.loadUrl(url)
    }

    override fun loadDataWithBaseUrl(baseUrl: String?, data: String?, mimeType: String?, encoding: String?, historyUrl: String?) {
        webView!!.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl)
    }
}